<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/echarts.js"></script>
    <script src="/js/jquery-2.1.1.min.js"></script>
</head>
<body>
<div id="main" style="width: 1200px;height:600px;"></div>
<script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    //发起get请求
    $.get('/echars/getNr', function (data) {
        myChart.setOption({
            series: [{data: data}],

        })
    });

    option = {
        title: {
            text: '历史页面栏目图',
            subtext: '实时获取',
            x: 'center'
        },
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} <br>分类 : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            //data: ['2018-07', '2018-08', '2018-09', '2018-10', '2018-11', '2018-12']
        },
        //系列列表。每个系列通过 type 决定自己的图表类型
        series: [
            {
                name: '栏目',
                type: 'pie',//饼状图
                radius: '55%',
                center: ['50%', '60%'],
                data: [],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
</script>
</body>
</html>